<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app" class="container">
        <router-view></router-view>
    </div>
    <!-- 一级 -->
    <template id="dsh">
        <div>
            <h1>董事会</h1>
            <router-link to="/dsh/sc">市场经理</router-link>
            <router-link to="/dsh/rs">人事经理</router-link>
            <router-link to="/dsh/cp">产品经理</router-link>
            <router-view></router-view>
        </div>
    </template>

    <!-- 二级-->
    <template id="sc">
        <div>
            <h2>市场经理</h2>
            <router-link to="/dsh/sc/scb">市场部</router-link>
            <router-link to="/dsh/sc/sj/">设计部</router-link>
            <router-link to="/dsh/sc/ywb">业务部</router-link>
            <router-link to="/dsh/rs/kfb">客服部</router-link>
            <router-view></router-view>
        </div>
    </template>
    <template id="rs">
        <div>
            <h2>人事经理</h2>
            <router-link to="/dsh/rs/cwb">财务部</router-link>
            <router-link to="/dsh/rs/xzb">行政部</router-link>
            <router-link to="/dsh/rs/rlzyb">人力资源部</router-link>
            <router-view></router-view>
        </div>
    </template>
    <template id="cp">
        <div>
            <h2>产品经理</h2>
            <router-link to="/dsh/cp/wlb">网络部</router-link>
            <router-link to="/dsh/cp/kfb">开发部</router-link>
            <router-link to="/dsh/cp/jsb">技术部</router-link>
            <router-view></router-view>
        </div>
    </template>
    <!-- 三级-->
    <template id="sheji">
        <div>
            <ul>
                <li>设计一部</li>
                <li>设计二部</li>
            </ul>
        </div>
    </template>
    <template id="kefu">
        <div>
            <ul>
                <li>客服服务</li>
                <li>技术支持</li>
            </ul>
        </div>
    </template>
    <template id="kaifa">
        <div>
            <ul>
                <li>开发一部</li>
                <li>开发二部</li>
            </ul>
        </div>
    </template>


</body>

</html>
<script type="module">
    import { } from '../js/vue.js';
    import { } from '../js/vue-router.js';

    let dsh = { template: "#dsh" }
    let sc = { template: "#sc" }
    let rs = { template: "#rs" }
    let cp = { template: "#cp" }
    let sheji = { template: "#sheji" };
    let kefu = { template: "#kefu" };
    let kaifa = { template: "#kaifa" };
    //路由定义
    let routes = [
        { path: '/', redirect: '/dsh' },

        {
            path: '/dsh', component: dsh,
            children: [
                {
                    path: 'sc', component: sc,
                    children: [
                        { path: 'sj', component: sheji }, // 设计部 - 设计一部
                        { path: 'kfb', component:  kefu}, // 客服部
                    ]
                },

                {
                    path: 'rs', component: rs,
                },
                {
                    path: 'cp', component: cp,
                    children: [
                        { path: 'kfb', component: kaifa }, // 业务部
                    ]
                },
            ],
        },
    ]

    //路由对象
    const router = new VueRouter({
        routes
    })


    new Vue({
        el: '#app',
        data: {
            msg: 'hello world'
        },
        methods: {
            //自定义方法
        },
        computed: {
            //计算属性
        },
        router,
    })
</script>